<?php 
namespace Library\IO;

/**
 * Provides static methods for the creation, copying, deletion, moving, and opening of files, and aids in the creation of FileStream objects.
 * @namespace Library\IO
 * @author Raphael DE FREITAS (RaphyTheGeek@gmail.com)
 * @version 1.0
 */
final class File
{
	/**
	 * Copies an existing file to a new file.
	 * @param string $source The file to copy.
	 * @param string $dest The name of the destination file. This cannot be a directory or an existing file.
	 * @return boolean TRUE on success; otherwise, FALSE.
	 */
	public static function copy($source, $dest) {
		return copy($source, $dest);
	}
	
	/**
	 * Deletes the specified file. 
	 * @param string $path The name of the file to be deleted.
	 * @return boolean TRUE on success; otherwise, FALSE.
	 */
	public static function delete($path) {
		return unlink($path);
	}
	
	/**
	 * Determines whether the specified file exists.
	 * @param string $path The file to check.
	 * @return boolean TRUE if path contains the name of an existing file; otherwise, FALSE.
	 */
	public static function exists($path) {
		return is_file($path);
	}
	
	/**
	 * Moves a specified file to a new location, providing the option to specify a new file name.
	 * @param string $oldname The name of the file to move. 
	 * @param string $newname The new path for the file.
	 * @return boolean RUE on success; otherwise, FALSE.
	 */
	public static function move($oldname, $newname) {
		return rename($oldname, $newname);
	}
	
}
?>